package cn.liye.pingfen.service.impl;

import cn.liye.pingfen.mapper.CommentMapper;
import cn.liye.pingfen.pojo.dto.CommentDTO;
import cn.liye.pingfen.pojo.entity.Comment;
import cn.liye.pingfen.pojo.vo.CommentVO;
import cn.liye.pingfen.service.ICommentService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class CommentService implements ICommentService {

    @Autowired
    CommentMapper commentMapper;
    @Override
    public void addNew(CommentDTO commentDTO) {
            Comment comment = new Comment();
            BeanUtils.copyProperties(commentDTO, comment);
            comment.setCreateTime(new Date());
            commentMapper.insertcomment(comment);
        }

    @Override
    public List<CommentVO> listById(Long companyId) {
            return commentMapper.selectById(companyId);
        }
    }
